package com.future;

import lombok.Data;

@Data
public class CommonResult<T> {

    private T data;

    private Integer code = 200;

    private String msg;

    public CommonResult(T data, Integer code, String msg) {
        this.data = data;
        this.code = code;
        this.msg = msg;
    }

    public CommonResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public CommonResult(T data, String msg) {
        this.data = data;
        this.msg = msg;
    }

    public static CommonResult fail() {
        return new CommonResult(201, "fail");
    }

    public static <T> CommonResult success(T data) {
        return new CommonResult(data, "ok");
    }


}
